package com.k8.common.util;

import com.k8.rpc.url.URL;

import static com.k8.common.constants.CommonKeyConstants.*;
import static com.k8.common.constants.SpiConstants.CACHED_THREAD_POOL;

//一开始需要初始化UROBuilder
public class URLBuilder {
    /**
     * url需要指定
     * 角色
     * 阻塞队列类型，特定阻塞队列需要指定额外参数 {@link com.k8.common.executor.threadPool.AbstractThreadPool#getBlockingQueue(URL)}
     * 指定核心线程数，最大线程数
     * 拒绝策略
     *
     * @see
     */

    public static URL getProviderThreaPoolConfigUrl() {
        URL url = new URL();
        url.setParameter(SIDE_KEY, PROVIDER);
        url.setParameter(THREAD_POOL_TYPE, CACHED_THREAD_POOL);
        return url;
    }

    public static URL getConsumerThreaPoolConfigUrl() {
        URL url = new URL();
        url.setParameter(SIDE_KEY, CONSUMER);
        url.setParameter(THREAD_POOL_TYPE, CACHED_THREAD_POOL);
        return url;
    }

}
